<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
		<title>监控地图</title>
		<link rel="stylesheet" href="https://lib.baomitu.com/font-awesome/4.7.0/css/font-awesome.min.css">
		<link rel="stylesheet" type="text/css" href="./map.css" />
		<link rel="stylesheet" type="text/css" href="./iconfont.css" />
		<style type="text/css">

		</style>
	</head>
	<body>
		<!-- 地图 -->
		<div id="container"></div>
		<!-- 功能按钮	 -->
		<div>
			<div id="info" class="positions" style="background-color: #FFFFFF;z-index: 99999;">

			</div>
			<div class="main positions" id="switchMap">卫星地图</div>
			<div class="main positions1" id="traffic">显示路况</div>
			<div class="main positions2" id="showTruckNo">显示车牌</div>
			<div class="main positions3" style="background: #ff7900;" id="checkCar">选择车辆</div>
		</div>

		<!-- 车辆详情 -->
		<div id="carDetail"></div>
		<!--  前置安装提醒-->
		<div id="Tips" class="tips">
			该车辆为前置安装，无法拨打电话联系车主。
		</div>
		<div id="Tips-location" class="tips-location">
			暂无该车辆定位信息
		</div>

		<!-- 选择车辆 -->
		<div id="modle_drawer" class="drawer">
			<div id="mask" class="drawer__mask"></div>
			<div id="content" class="drawer__content"></div>
		</div>

		<!--  恢复初始化-->
		<div id="iocn" class="icon-font" style="bottom: 200px;right:10px">
			<i class="iconfont iconsuofang"></i>
		</div>

		<!-- SDK -->
		<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js">
		</script>
		<script type="text/javascript" src='https://webapi.amap.com/maps?v=1.4.15&key=b5af6d525e8796f797ccad004b6aa444'>
		</script>
		<script type="text/javascript" src="https://lib.baomitu.com/jquery/1.12.4/jquery.min.js"></script>
		<script src="https://webapi.amap.com/demos/js/liteToolbar.js" type="text/javascript"></script>
		<script type="text/javascript">
			// 初始化地图容器
			$("#container").width(document.documentElement.clientWidth).height(document.documentElement
				.clientHeight);
			//  tag  颜色  light
			var success = {
				"color": "#19be6b",
				"background-color": "#d7f0db",
				"border-color": "#d7f0db"
			}
			var error = {
				"color": "#ed3f14",
				"background-color": "#fadbd9",
				"border-color": "#fadbd9"
			}
			var primary = {
				"color": "#5677fc",
				"background-color": "#c7eaff",
				"border-color": "#c7eaff"
			}
			var warning = {
				"color": "#ff7900",
				"background-color": "#fde6d2",
				"border-color": "#fde6d2"
			}
			var defaults = {
				"color": "#333",
				"background-color": "#fafafa",
				"border-color": "#fafafa"
			}
			var gray = {
				"color": "#999",
				"background-color": "#ededed",
				"border-color": "#ededed"
			}
			/*
			ApiUrl ---  接口环境
			Token  ---  认证
			*/
			// 获取url参数
			var GetQueryString = function(name) {
				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
				var r = location.search.substr(1).match(reg);
				if (r != null) return unescape(r[2]);
				return null;
			}

			// var ApiUrl = "http://42.193.13.198:9013"; // - 测试
			var ApiUrl = "https://gateway.xbtruck.com/lk-truck-webfront"; // - 正式

			var info = {
				type: 1,
				token: '',
				truckId: ''
			}
			var info = JSON.parse(GetQueryString("info")) ? JSON.parse(GetQueryString("info")) : info

			// 全局数据
			var provincesList = []
			var citysList = []
			var carList = null
			var carMakersList = []



			var map = new AMap.Map('container', {
				resizeEnable: true,
				showIndoorMap: true,
				zoom: 4,
				center: [116.20, 39.56]
			});
			//设置地图比例尺
			AMap.plugin(['AMap.Scale'],
				function() {
					map.addControl(new AMap.Scale());
				});



			var initData = function() {
				$.ajax({
					url: ApiUrl + "/region/getTruckRegionData",
					dataType: "json",
					type: "GET",
					data: {
						installType: info.type,
					},
					async: false,
					contentType: "application/json;charset=UTF-8",
					headers: {
						"Authorization": info.token
					},
					success: function(res) {
						if (res.data.province || res.data.city) {
							provincesList = res.data.province
							citysList = res.data.city
						} else {
							$("#Tips-location").show()
							$("#Tips-location").text('暂无数据')
							setTimeout(() => {
								$("#Tips-location").hide()
							}, 2000)
							$("#showTruckNo").hide();
							$("#checkCar").hide()
						}
					},
				})
			}

			var equipNoArr = []
			var getCarList = function(data) {
				$.ajax({
					url: ApiUrl + "/region/getTruckRegionDataByCoordinate",
					dataType: "json",
					type: "POST",
					data: JSON.stringify({
						distance: data.distance,
						installType: info.type,
						latitude: data.latitude,
						longitude: data.longitude,
					}),
					headers: {
						"Authorization": info.token
					},
					contentType: "application/json;charset=UTF-8",
					async: false,
					success: function(res) {
						if (res.data) {
							equipNoArr = []
							carMakersList = res.data
							res.data.forEach(item => {
								equipNoArr.push(item.equipNo)
							})
							map.remove(scatterMaker)
							initScatterMaker(res.data)
							let arr = Array.from(new Set(equipNoArr));
							if (!timer) {
								updateTask(arr)
							}
						}
					},
				})
			}

			//定时刷新位置
			var timer = null
			var updateTask = function(data) {
				if (getZoom > 16) {
					isShowTruckNo = false
				}
				// 1分钟刷新一次数据
				timer = setInterval(() => {
					console.log('===== 更新定位 =====', data)
					refreshList(data);
				}, 5 * 1000)
			}

			var refreshList = function(equipNos) {
				$.ajax({
					url: ApiUrl + "/region/getTruckLocationByEquipNos",
					dataType: "json",
					type: "POST",
					data: JSON.stringify({
						installType: info.type,
						equipNos: equipNos
					}),
					contentType: "application/json;charset=UTF-8",
					async: false,
					headers: {
						"Authorization": info.token
					},
					success: function(res) {
						if (res.data) {
							map.remove(scatterMaker)
							initScatterMaker(res.data)
							res.data.forEach(item => {
								equipNoArr.push(item.equipNo)
							})

							if (res.data.length === 1 && carTruck) {
								_scatterClick(null, res.data[0])
							}

						}
					},
				})
			}
			var truckList = new Map();
			var chooseCar = function() {
				$.ajax({
					url: ApiUrl + "/truck/getAllTruckLocation",
					dataType: "json",
					type: "POST",
					data: {
						installType: info.type
					},
					async: false,
					headers: {
						"Authorization": info.token
					},
					success: function(res) {
						if (res.data.length) {
							carList = res.data
							res.data.forEach(x => {
								truckList.set(x.id, x)
							})
						}
					},
				})
			}

			//点击icon恢复初始化
			$('#iocn').click((e) => {
				map.setZoom(4, false);
				map.setCenter([116.20, 39.56])
				_endTack()
			})

			var getBound
			var getZoom
			var getCenter
			//添加监听时间，当前缩放级别
			AMap.event.addListener(map, 'zoomend', function() {
				// document.getElementById('info').innerHTML = '当前缩放级别：' + map.getZoom();
				// document.getElementById('info').innerHTML = '当前可视范围点：' + map.getBounds();
				getZoom = map.getZoom();
				getBound = map.getBounds();
			});
			AMap.event.addListener(map, 'moveend', function() {
				// document.getElementById('info').innerHTML = '当前缩放级别：' + map.getZoom();
				// document.getElementById('info').innerHTML = '当前可视范围点：' + map.getBounds();
				getBound = map.getBounds();
				getCenter = map.getCenter()

				if ((map.getZoom() > 8 && map.getZoom() < 13) || map.getZoom() === 8) {
					_onMouseout();
				}

				if (map.getZoom() < 8 && map.getZoom() !== 7) {
					_endTack()
				}

			});


			//建立聚合点 
			var createMarker = function(data, index) {
				var div = document.createElement('div');
				div.className = 'circle';

				var r = Math.floor(data.number / 1024);
				div.style.backgroundColor = (index === 2) ? '#7169e1' : '#5677fc';
				let name = data.name && data.name.length > 3 ? (data.name.slice(0, 3)) : data.name
				if (data.name && data.name.indexOf('自治区') !== -1) {
					name = data.name.slice(0, 2)
				}
				var htmlData =
					`
					<p>${name}<p>
					<p>${data.number}</p>
					`
				div.innerHTML = htmlData;

				marker = new AMap.Marker({
					content: div,
					position: data.center.split(','),
					offset: new AMap.Pixel(-20, -20),
					zIndex: data.number,
					opacity: 0.8,
					id: data.id,
					data: data,
				})
				marker.setMap(map)
				return marker;
			}

			//  聚合数据
			var markers
			var initMaker = function(data, index) {
				markers = []
				// 初始化maker
				for (var i = 0; i < data.length; i++) {
					marker = createMarker(data[i], index);
					markers.push(marker);
					if (index == 1) {
						//绑定点击事件
						AMap.event.addListener(marker, 'click', _onClick);
					} else if (index == 2) {
						AMap.event.addListener(marker, 'click', _onClickTwo);
					}

				}
				AMap.event.addListener(map, 'zoomend', _onZoomEnd);
			}

			var icon
			var createScatterMaker = function(data) {

				if (carTruck && carTruckId === data.id) {
					icon = new AMap.Icon({
						image: './truck_select.png',
						imageSize: new AMap.Size(18, 40)
					})
				} else {
					icon = new AMap.Icon({
						image: data.isOnline ? './truck_active.png' : './truck.png',
						imageSize: new AMap.Size(18, 40)
					})
				}

				var label
				if (isShowTruckNo && data.truckNo) {
					label = {
						content: data.preSale ? (data.isOnline ?
							`<div id='lable'>${data.truckFrameNo}</div>` :
							`<div id='lable1'>${data.truckFrameNo}</div>`) : (
							data.isOnline ?
							`<div id='lable'>${data.truckNo.substring(0, 2) + "·" + data.truckNo.substring(2)}</div>` :
							`<div id='lable1'>${data.truckNo.substring(0, 2) + "·" + data.truckNo.substring(2)}</div>`
						),
						offset: new AMap.Pixel(-25, -18),
					}
				} else {
					label = null
				}

				if (data.id) {
					marker = new AMap.Marker({
						position: [data.gpsInfo.lonLat.longitude, data.gpsInfo.lonLat.latitude],
						offset: new AMap.Pixel(-20, -20),
						zIndex: data.number,
						opacity: 0.8,
						icon: icon,
						id: data.id,
						data: data,
						angle: data.gpsInfo.direction,
						autoRotation: true,
						label: label
					})
				}
				marker.setMap(map)
				return marker;
			}

			// 散点数据
			var scatterMaker = []
			var initScatterMaker = function(data) {
				scatterMaker = []
				if (!data.length) {
					marker = createScatterMaker(data);
					scatterMaker.push(marker);
					//绑定点击事件
					AMap.event.addListener(marker, 'click', _scatterClick);
				} else {
					// 初始化maker
					for (var i = 0; i < data.length; i++) {
						marker = createScatterMaker(data[i]);
						scatterMaker.push(marker);
						//绑定点击事件
						AMap.event.addListener(marker, 'click', _scatterClick);
					}
				}
			}


			//  恢复默认选项
			var _endTack = function() {
				carTruck = null
				if (infoWindow) {
					infoWindow.close();
				}
				$("#carDetail").hide();
				if (timer) {
					clearInterval(timer)
					timer = null
				}
				$("#showTruckNo").hide();
				$("#checkCar").css('top', "125px");
			}


			// 移动视图
			var _onMouseout = function() {
				console.log('==== 移动 ===')
				map.remove(markers)
				map.remove(scatterMaker)
				var northeast = getBound.northeast.toString().split(',')
				var southwest = getBound.southwest.toString().split(',')
				var distance = getGreatCircleDistance(southwest[0], southwest[1], northeast[0], northeast[1])

				let data = {
					distance: distance,
					latitude: getCenter.toString().split(',')[1],
					longitude: getCenter.toString().split(',')[0],
				}
				getCarList(data);
			}


			//  marker点击事件
			var _onClick = function(e) {
				const {
					center
				} = e.target.Ce.data
				console.log('点击一级', e.target.Ce.data);
				map.setCenter(center.split(','))
				map.remove(markers)
				initMaker(citysList, 2)
				// map.setFitView(markers);
				map.setZoom(7)
			}

			// 计算两点距离
			var EARTH_RADIUS = 6378137.0; //单位M
			var PI = Math.PI;

			function getRad(d) {
				return d * PI / 180.0;
			}
			var getGreatCircleDistance = function(lng1, lat1, lng2, lat2) {

				var radLat1 = getRad(lat1);
				var radLat2 = getRad(lat2);

				var a = radLat1 - radLat2;
				var b = getRad(lng1) - getRad(lng2);
				var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math
					.pow(Math.sin(b / 2), 2)));
				s = s * EARTH_RADIUS;
				s = (Math.round(s * 10000) / 10000.0) * 0.001
				return s
			}

			var _showPlate = function(e) {

			}

			var isShowTruckNo = false
			var _onClickTwo = function(e) {
				console.log('====点击二级====', e.target.Ce.data);
				const {
					center,
				} = e.target.Ce.data
				map.remove(markers)


				var northeast = getBound.northeast.toString().split(',')
				var southwest = getBound.southwest.toString().split(',')
				var distance = getGreatCircleDistance(southwest[0], southwest[1], northeast[0], northeast[1])

				let data = {
					distance: distance,
					latitude: center.split(',')[1],
					longitude: center.split(',')[0],
				}
				isShowTruckNo = true
				getCarList(data);
				map.setFitView(scatterMaker);
				map.setCenter(center.split(','))
				map.setZoom(8)

			}




			var carTruck
			var carTruckId
			var infoWindow
			// 点击车辆icon
			var _scatterClick = function(e, item) {
				carTruck = e ? e.target.Ce.data : item
				carTruckId = e ? e.target.Ce.data.id : item.id
				
				const {
					gpsInfo,
				} = carTruck
				let lnglat = [gpsInfo.lonLat.longitude, gpsInfo.lonLat.latitude]
				map.setCenter(lnglat);
				map.setZoom(17);
				isShowTruckNo = false
				$("#showTruckNo").hide();
				$("#checkCar").css('top', "125px");
				if (timer) {
					clearInterval(timer)
					timer = null
				}
				updateTask(carTruck.equipNo.split())

				calloutContent = carTruck.truckNo ? carTruck.truckNo : carTruck.truckFrameNo
				// 熄火
				if (!carTruck.isOnline) {
					calloutContent += `</br>熄火${carTruck.onlineTime}`
				} else { //运行
					if (carTruck.gpsInfo.speed) {
						calloutContent += `</br>车速${carTruck.gpsInfo.speed}km/h`
					}
					if (carTruck.gpsInfo.height) {
						calloutContent += `</br>海拔${carTruck.gpsInfo.height}m`
					}
				}
				// 构建信息窗体
				infoWindow = new AMap.InfoWindow({
					content: carTruck ? calloutContent : '',
					offset: new AMap.Pixel(-10, -20),
					autoMove: true,
				});
				infoWindow.open(map, lnglat);
				let newIcon = new AMap.Icon({
					image: './truck_select.png',
					imageSize: new AMap.Size(18, 40)
				})

				if (e) {
					e.target.setIcon(newIcon);
				}

				if (carTruck && $("#carDetail").is(":hidden")) {
					$("#carDetail").show()
				}

				$("#carDetail").empty();

				div =
					`
				<div id="detail_main">
					<div style="width: 60px;margin-left:4px">
						<img id="carImg" src="./truck_active.png" style="width: 60px; height: 60px;">
					</div>
					<div >
						<div style="font-size: 14px;margin-top: 6px;">
							<span>${carTruck.truckNo?carTruck.truckNo:carTruck.truckFrameNo}</span>
							<span>【${carTruck.name?carTruck.name:"前装"}】</span>
						</div>
						<div style="font-size: 12px;color: #777777;margin-top:6px;">
							<span>${carTruck.brandName?carTruck.brandName:''} |</span>
							<span>${carTruck.engineName?carTruck.engineName:''} |</span>
							<span>${carTruck.mali} 匹 </span>
						</div>
						<div style="margin-top:6px; margin-bottom: 6px;  ">
							<span class="detail_location">${carTruck.location?carTruck.location:'暂无GPS定位'}</span>
						</div>
						<div id="tag" style="margin-top:6px; margin-bottom: 6px;  ">
						</div>
					</div>
				</div>
				<div id="allBtn" >
					<div class="btn" id="makePhoneCall">
						<i class="fa fa-phone" aria-hidden="true" ></i>
						<span>联系车主</span>
					</div>
					<div class="btn" id="navigateToPage" style="border-left-width: 1px;  border-left-style: solid;  border-left-color: #eaeef1;">
						<i class="fa fa-wrench" aria-hidden="true"></i>
						<span>进入诊断</span>
					</div>
				</div>
				`
				$("#carDetail").append(div);

				$("#carImg ").attr("src", carTruck.brandImageUrl);

				if (carTruck.marks.length <= 4) {
					carTruck.marks.forEach((item, index) => {
						$("#tag").append(
							`<div id="${index}" class="uni-tag" style="margin-right: 8px;">${item.content}</div>`
						)
						if (item.color === "success") {
							$(`#${index}`).css(success)
						}
						if (item.color === "error") {
							$(`#${index}`).css(error)
						}
						if (item.color === "primary") {
							$(`#${index}`).css(primary)
						}
						if (item.color === "warning") {
							$(`#${index}`).css(warning)
						}
						if (item.color === "default") {
							$(`#${index}`).css(defaults)
						}
					})
				} else {
					carTruck.marks.slice(0, 3).forEach((item, index) => {
						$("#tag").append(
							`<div id="${index}" class="uni-tag" style="margin-right: 8px;">${item.content}</div>`
						)
						if (item.color === "success") {
							$(`#${index}`).css(success)
						}
						if (item.color === "error") {
							$(`#${index}`).css(error)
						}
						if (item.color === "primary") {
							$(`#${index}`).css(primary)
						}
						if (item.color === "warning") {
							$(`#${index}`).css(warning)
						}
						if (item.color === "default") {
							$(`#${index}`).css(defaults)
						}
					})
					carTruck.marks.slice(3).forEach((item, index) => {
						$("#tag").append(
							`<div id="${index}" class="uni-tag" style="margin-right: 8px;">${item.content}</div>`
						)
						if (item.color === "success") {
							$(`#${index}`).css(success)
						}
						if (item.color === "error") {
							$(`#${index}`).css(error)
						}
						if (item.color === "primary") {
							$(`#${index}`).css(primary)
						}
						if (item.color === "warning") {
							$(`#${index}`).css(warning)
						}
						if (item.color === "default") {
							$(`#${index}`).css(defaults)
						}
					})
				}

			}



			var _onZoomEnd = function(e) {
				let zoomend = map.getZoom()
				if (zoomend < 6) {
					map.remove(markers)
					map.remove(scatterMaker)
					initMaker(provincesList, 1)
				}
				if (zoomend > 6 && zoomend < 8) {
					map.remove(markers)
					map.remove(scatterMaker)
					initMaker(citysList, 2)
				}
				if (zoomend > 8) {
					map.remove(markers)
				}
			}

			// 选择车辆
			var checkCars = function(data) {
				$("#content").empty();
				for (let x = 0; x < data.length; x++) {
					let i = data[x].id + '1'
					let list =
						`
					<ul>
						<li class="list-item" id="${data[x].id}">
							<div id="heade-title" style="padding:12px;">
								<div class="title">${data[x].truckNo?data[x].truckNo:data[x].truckFrameNo}【${data[x].name?data[x].name:'前装'}】</div>
								<div class="note">${data[x].city?data[x].city:'暂无定位'}</div>
							</div>
							<div style="margin-right:12px" >
								<div class="uni-tag" id="${i}" style="border-radius: 15px;margin-left: 8px;">${data[x].isOnline?'运行':'熄火'}</div>
							</div>
						</li>
					</ul>
					`
					$("#content").append(list)
					if (data[x].isOnline) {
						$(`#${i}`).css(success);
					} else {
						$(`#${i}`).css(gray);
					}

					$(`#${data[x].id}`).click(function() {
						$("#modle_drawer").hide();
						carTruck = data[x]
						carTruckId = data[x].id
						console.log("=== 选择车辆 ====", carTruck)
						map.remove(markers)
						map.remove(scatterMaker)

						initScatterMaker(carTruck)
						_scatterClick(null, carTruck)

						if (!timer) {
							updateTask(carTruck.equipNo.split())
						}
					})

				}
			}

			var _loading = function() {
				return div = `
				<div class="spinner">
				  <div class="rect1"></div>
				  <div class="rect2"></div>
				  <div class="rect3"></div>
				  <div class="rect4"></div>
					<p>加载中...</p>
				</div>
				`
			}

			var first = false
			//选择车辆  打开抽屉
			$("#checkCar").click(() => {
				$("#modle_drawer").show()

				setTimeout(() => {
					chooseCar();
					checkCars(carList)
				}, 0)

				if (carList) {
					$("#content").empty();
					checkCars(carList);
				} else {
					_loading()
					$("#content").append(div);
				}
			})
			//点击遮罩层关闭抽屉
			$("#mask").click(() => {
				$("#modle_drawer").hide()
			})

			// 功能按钮
			document.addEventListener('UniAppJSBridgeReady', function() {
				// 联系车主
				$("#carDetail").on('click', '#makePhoneCall', function(e) {
					console.log(carTruck)
					if (carTruck.preSale) {
						$("#Tips").show()
						setTimeout(function() {
							$("#Tips").hide()
						}, 2000)
					} else {
						uni.postMessage({
							data: {
								action: "telephone", // pageTo（页面跳转）telephone（拨打电话）
								data: carTruck.mobile
							}
						});
					}

				})
				//  进入诊断
				$("#carDetail").on('click', '#navigateToPage', function(e) {
					uni.postMessage({
						data: {
							action: "navigateTo", // pageTo（页面跳转）telephone（拨打电话）
							data: {
								equipNo: carTruck.equipNo,
								truckNo: carTruck.truckNo,
								pageType: 1,
								subUrl: "/#/"
							}
						}
					});
				})
			});
			var layers = []
			var layer1 = new AMap.TileLayer.Satellite();
			var layer2 = new AMap.TileLayer.RoadNet();
			if (layers.length) {
				layers.forEach(item => {
					if (item.CLASS_NAME == 'AMap.TileLayer.Satellite') {
						map.add([layer1]);
					}
					if (item.CLASS_NAME == 'AMap.TileLayer.RoadNet') {
						map.add([layer2]);
					}
				})
			}

			// 功能按钮点击事件
			$("#switchMap").click(function() {
				let text = $('#switchMap').text()
				if (text === '卫星地图') {
					layers.push(layer1)
					$('#switchMap').text('普通地图')
					map.add(layers);
				} else {
					map.remove(layer1);
					for (let i = 0; i < layers.length; i++) {
						if (layers[i].CLASS_NAME === 'AMap.TileLayer.Satellite') {
							layers.splice(i, 1)
						}
					}
					$('#switchMap').text('卫星地图')
				}
			});
			$("#traffic").click(function() {
				let text = $('#traffic').text()
				if (text === '显示路况') {
					layers.push(layer2)
					$('#traffic').text('隐藏路况')
					map.add(layers);
				} else {
					map.remove(layer2);

					for (let i = 0; i < layers.length; i++) {
						if (layers[i].CLASS_NAME === 'AMap.TileLayer.RoadNet') {
							layers.splice(i, 1)
						}
					}
					$('#traffic').text('显示路况')
				}

			});

			// 聚合数据
			setTimeout(() => {
				initData();
				initMaker(provincesList, 1);
			}, 0)
			$("#showTruckNo").hide();
			$("#checkCar").css('top', "125px");


			// 带车辆id进来时
			if (info.truckId) {
				chooseCar();

				carTruckId = Number(info.truckId)
				carTruck = truckList.get(carTruckId)

				if (carTruck === undefined) {
					$("#Tips-location").show()
					setTimeout(function() {
						$("#Tips-location").hide()
					}, 2000)
				} else {
					console.log("=== 当前车辆 ====", carTruck)
					if (markers) {
						map.remove(markers)
					}
					if (scatterMaker) {
						map.remove(scatterMaker)
					}

					initScatterMaker(carTruck)
					_scatterClick(null, carTruck)
					// $("#showTruckNo").show();
					// $("#checkCar").css('top', "175px");
					if (!timer) {
						updateTask(carTruck.equipNo.split())
					}
				}

			}
		</script>
	</body>
</html>
